<?php

/**
 * vulnerabilidad actions.
 *
 * @package    vulnerabilidades
 * @subpackage vulnerabilidad
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class vulnerabilidadActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $this->vulnerabilidad_list = VulnerabilidadPeer::doSelect(new Criteria());
  }

  public function executeShow(sfWebRequest $request)
  {
    $this->vulnerabilidad = VulnerabilidadPeer::retrieveByPk($request->getParameter('id'));
    $this->forward404Unless($this->vulnerabilidad);
  }

  public function executeNew(sfWebRequest $request)
  {
    $this->form = new VulnerabilidadForm();
  }

  public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod('post'));

    $this->form = new VulnerabilidadForm();

    $this->processForm($request, $this->form);

    $this->setTemplate('new');
  }

  public function executeEdit(sfWebRequest $request)
  {
    $this->forward404Unless($vulnerabilidad = VulnerabilidadPeer::retrieveByPk($request->getParameter('id')), sprintf('Object vulnerabilidad does not exist (%s).', $request->getParameter('id')));
    $this->vulName = $vulnerabilidad->getTitulo();
    $this->form = new VulnerabilidadForm($vulnerabilidad);
  }

  public function executeUpdate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
    $this->forward404Unless($vulnerabilidad = VulnerabilidadPeer::retrieveByPk($request->getParameter('id')), sprintf('Object vulnerabilidad does not exist (%s).', $request->getParameter('id')));
    $this->form = new VulnerabilidadForm($vulnerabilidad);

    $this->processForm($request, $this->form);

    $this->setTemplate('edit');
  }

  public function executeDelete(sfWebRequest $request)
  {
    $request->checkCSRFProtection();

    $this->forward404Unless($vulnerabilidad = VulnerabilidadPeer::retrieveByPk($request->getParameter('id')), sprintf('Object vulnerabilidad does not exist (%s).', $request->getParameter('id')));
    $vulnerabilidad->delete();

    $this->redirect('vulnerabilidad/index');
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $vulnerabilidad = $form->save();

      $this->redirect('vulnerabilidad/edit?id='.$vulnerabilidad->getId());
    }
  }
  
  public function executeSearch(sfWebRequest $request)
  {
    $criteria = new Criteria();
    if ($request->getParameter('keywords') != ""){
      $criteria->add(VulnerabilidadPeer::TITULO,
      '%'.$request->getParameter('keywords').'%', Criteria::LIKE);
    }  
    $this->vulnerabilidad_list = VulnerabilidadPeer::doSelect($criteria);
    return sfView::SUCCESS;
  }
 
  public function executeReportxss(sfWebRequest $request){
    return sfView::SUCCESS;
  }
  
  public function executeReportpharming(sfWebRequest $request){
    return sfView::SUCCESS;
  }
  
  public function executeReportspoofing(sfWebRequest $request){
    return sfView::SUCCESS;
  }

  public function executeReportsafeconf(sfWebRequest $request){
    return sfView::SUCCESS;
  }
  
  public function executeReportphishing(sfWebRequest $request){
    return sfView::SUCCESS;
  }
  
  public function executeReportsql(sfWebRequest $request){
    return sfView::SUCCESS;
  }
}
